package com.clms.rents.controller;

import com.clms.common.R;
import com.clms.rents.pojo.entity.TbCarComment;
import com.clms.rents.pojo.entity.TbCarTypeConfigDetails;
import com.clms.rents.pojo.vo.CarCommentVo;
import com.clms.rents.service.CarCommentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-third
 * @description: 车辆评论
 * @author: 杨浩
 * @create: 2021-07-23 14:55
 **/

@RestController
@RequestMapping("rents/comment")
public class CarCommentController {

    @Resource
    private CarCommentService carCommentService;

    @PostMapping("selectall/{currentPage}/{pageSize}")//
    public R selectall(@PathVariable Integer currentPage,
                       @PathVariable Integer pageSize,
                       @RequestBody CarCommentVo carCommentVo){
        return carCommentService.selectall(currentPage,pageSize,carCommentVo);
    }

    @PostMapping("insert")
    public R insert(@RequestBody TbCarComment tbCarComment){
        return carCommentService.insert(tbCarComment);
    }

    @GetMapping("selectById/{id}")
    public R selectByid(@PathVariable Integer id){
        return carCommentService.selectById(id);
    }

    @PutMapping("update")
    public R update(@RequestBody TbCarComment tbCarComment){
        return carCommentService.update(tbCarComment);
    }
    @DeleteMapping
    public R delete(@RequestParam Integer id){
        return carCommentService.delete(id);
    }
}
